<div class="sortlist mgt20">
				<h1>共 <{$count}> 个回答</h1>
</div>
<style>
#CommentList .media-content{ border-bottom:1px solid #ddd; padding-bottom:10px; margin-left:40px} 
#CommentList .media-repter{ background-color:#F7F7F7; padding:10px;}
</style>
<div id="CommentList" class="mgt20 after_div">
				<volist name="data" id="vo">
								<div class="media media-comment-<{$vo.id}>"> 
												<div class="media-content" style="margin:0px;">
																
																<div class="answer-content "> <span <if condition="$vo['is_best'] neq 1">style="display:none"</if>class="btn  btn-success a_bnt  btn-xs bnt_best_tag">已采纳</span> &nbsp;&nbsp;<{$vo['content']}> </div>
																<if condition="$vo['comment']">
																				<div class="media-repter "> <a style="color:#5cb85c" href="/User/index/user_id/<{$vo.user_id}>"  data-iduser="<{$vo.comment.user_id}>"><{$vo.comment.user.nickname}></a> <{:cutstr(strip_tags($vo['comment']['content']),"50")}> </div>
																</if>
																	<div class="muted mgt10">
																	<div class="s_left">
																	<a title="<{$vo.user.nickname}>" href="/User/index/user_id/<{$vo.user_id}>" target="_blank" class="small-avatar" > <img src="<{$vo.user.headimg}>" width="20" height="20"> </a>
																	<php>$tag=Widget('BoxEdu/Index/user_tag',$vo['user_id'])</php>
																<if condition="$tag eq '资深人士'"> <a class="label label-success" ><{$tag}></a> </if>
																<{$vo['time_tran']}>
																</div>
																<div class="pull-right"><a onclick="reply_btn(this)"  data-id="<{$vo.id}>"  ><i class="icon-icon-09" title="回复"></i></a>  
																</if>
																<if condition="$topic_info['is_best'] neq 1 and $topic_info['user_id'] eq $user_info['user_id']"> <a href="<{:U('Subject/accept',array('comment_id'=>$vo['id']))}>"  confirm="1" title="确认采纳该回答吗？"  data-type="ajaxGet"><i style="color:#00d449" class="icon-icon-26" title="采纳"></i></a>  </if>
																<if condition="$vo['del_act'] eq 1"> <a href="/BoxSns/Home/Index/del_comment/comment_id/<{$vo['id']}>" data-id="<{$vo.id}>"  confirm="1" title="确认删除该回答吗？"  data-type="ajaxGet"><i class="icon-icon-20" style="color:red" title="删除"></i></a> </if>
												</div>
																<div class="clearfix"></div>
																	</div>			
												</div>
								</div>
				</volist>
</div>
<include file="Public:pager" />
<form action="/BoxSns/Home/Index/do_comment" id="addComment"  data-type="ajaxSubmit" method="post" style="padding-bottom:20px;">
				<volist name="params['form']"   id="vo">
								<input type="hidden" name="<{$key}>" value="<{$vo}>" />
				</volist>
				<input type="hidden" name="type" value="<{$params['type']}>" />
				<input type="hidden" name="pid" value="<{$params['topic_id']}>" />
				<input type="hidden" name="to_comment_id" value="0" />
				<textarea style="width:100%" name="content"  data-type="kindeditor"  placeholder="请在这里输入你的答案"></textarea>
				<div class="col-md-4" style="float:right; text-align:right">
								<button id="btnAsk" type="submit" class="btn mgt20 btn-block btn-success btn-large a_bnt">提交答案</button>
				</div>
				<div class="clearfix"></div>
</form>
<script type="text/html" id="answerListItemHtml">
<div>
	<div class="media media-comment-{{items.id}>"> 
	 <a href="/User/index/user_id/{{items.user_id}}" target="_blank" class="small-avatar mgr10"> <img src="{{items.user.headimg}}" width="20" height="20"> </a> <a href="/User/index/user_id/{{items.user_id}}" target="_blank" class="f12 muted" data-iduser="68151">{{items.user.nickname}}</a> <span class="muted pull-right mgl10 f12">{{items['time_tran']}}</span>
		<div class="answer-content mgt10">
			<p>{{#items['content']}}</p>
		</div>
	</div>
</div>	
</script> 
<script type="text/javascript">

 	$("#addComment").on("ajaxSubmitSuccess",function(e,content){
		 var data= JSON.parse(content);
		 if(data.error>0){
			 dialog(data.msg)
		}else{
			 $("#addComment").find('[data-type="kindeditor"]').val("");
			 $("#addComment").find('[data-type="kindeditor"]').trigger("kindeditorChange");
			 box_render(data.msg,$("#answerListItemHtml").html(),$("#CommentList"),"append");
		}
	})
	
	$(function(){
		$(".best_btn").on("ajaxGetSuccess",function(e,content){
			 var data= JSON.parse(content);
							if(data.error>0){
								dialog(data.msg);
						}else{
								 	dialog("回答采纳成功");
										$(this).parent().parent().find(".bnt_best_tag").show();
										$(this).parents("#CommentList").find(".best_btn").parent().hide();
						}
			})
			
			$(".del_btn").on("ajaxGetSuccess",function(e,content){
			 var data= JSON.parse(content);
							if(data.error>0){
								dialog(data.msg);
						}else{
								 	dialog("删除成功");
										var id=$(this).attr("data-id");
										$(".media-comment-"+id).hide();
						}
			})
			
	
	})
	
	function reply_btn(_this){
		    var to_comment_id=$(_this).attr("data-id");
				  $("#addComment").find("[name='to_comment_id']").val(to_comment_id);
					 $('html,body').animate({scrollTop:$('#addComment').offset().top}, 800);
				  
		}
	
 </script> 
